package com.wj.controller.json;

import com.wj.domain.Girl;
import com.wj.repository.GirlRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by wj on 2017/9/11.
 */

@RestController
public class GirlController {
    @Autowired
    private GirlRepository girlRepository;

    @GetMapping("girls")
    public List<Girl> girlList(){
        List<Girl> girls = girlRepository.findAll();
        return girls;
    }

    @GetMapping("girl")
    public Girl findone(){
        Girl girl = girlRepository.findOne(1);
        girl.getAge();
        return girl;
    }
}
